home *** CD-ROM | disk | FTP | other *** search
- Path: newsbf02.news.aol.com!not-for-mail
- From: tycope@aol.com (Tycope)
- Newsgroups: comp.lang.c
- Subject: Simple Program Question
- Date: 26 Feb 1996 12:40:14 -0500
- Organization: America Online, Inc. (1-800-827-6364)
- Sender: root@newsbf02.news.aol.com
- Message-ID: <4gsr9u$sk6@newsbf02.news.aol.com>
- Reply-To: tycope@aol.com (Tycope)
- NNTP-Posting-Host: newsbf02.mail.aol.com
-
- I am trying to write a non -interactive program that calculates all
- integer triples (i, j, k) such that
- 0 < i < j < k < l and i + j + k = l. Print out the number of triples that
- satisfy the requirements and print out every millionth triple. Can anyone
- see where I am missing the boat in the following code. The program runs
- and immediately terminates. Thanks in advance for any feedback.
-
- #include <stdio.h>
-
- long int i, j, k, l;
- long int count;
-
- int
- main (void)
- {
- do
- {
- (l = i + j + k);
- (i = 1);
- (j = 2);
- (k = 3);
- (i++, j++, k++);
- (++count);
- if (count % 1000000 == 0)
- {
- printf("%ld(i) + %ld(j) + %ld(k) = %ld(l)", i, j, k, l);
- }
-
- } while (0 < i < j < k < l);
-
- return (0);
- }
-